home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
newsgroups
/
misc.19970626-19970929
/
000342_news@newsmaster….columbia.edu _Thu Sep 11 10:37:40 1997.msg
< prev
next >
Wrap
Internet Message Format
|
2020-01-01
|
4KB
Return-Path: <news@newsmaster.cc.columbia.edu>
Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.35.30])
by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id KAA25381
for <kermit.misc@watsun.cc.columbia.edu>; Thu, 11 Sep 1997 10:37:38 -0400 (EDT)
Received: (from news@localhost)
by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id KAA29879
for kermit.misc@watsun; Thu, 11 Sep 1997 10:37:38 -0400 (EDT)
Path: news.columbia.edu!watsun.cc.columbia.edu!fdc
From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
Newsgroups: comp.protocols.kermit.misc
Subject: Re: MSDOS Kermit to Kermit/2..
Date: 11 Sep 1997 14:37:36 GMT
Organization: Columbia University
Lines: 76
Message-ID: <5v8vng$sml$1@apakabar.cc.columbia.edu>
References: <TCPSMTP.17.9.11.0.45.8.2375661496.4684067@kincyb.com>
NNTP-Posting-Host: watsun.cc.columbia.edu
Xref: news.columbia.edu comp.protocols.kermit.misc:7664
In article <TCPSMTP.17.9.11.0.45.8.2375661496.4684067@kincyb.com>,
<dallasii@kincyb.com> wrote:
: ...
: Here is what I found to work, when the .CMD file is both in the
: path, or the current directory:
:
: EXTPROC D:\K2\K2.EXE
: ; C:\USR\COMM\Ktest7.CMD
: echo \&@[0] \&@[1] \&@[2] \&@[3] ... (etc)
: IF DEFINED \&@[2] ASSIGN \%1 \&@[2]
: IF DEFINED \&@[3] ASSIGN \%2 \&@[3]
: IF DEFINED \&@[4] ASSIGN \%3 \&@[4]
: echo \%1 \%2 \%3 \%4 \7 \7 \7 \7 \7 the input
: echo Ktest7!\13\10
: EXIT
:
: then I type:
: ktest7 a b c d e f g
:
: which output:
:
: D: KTEST7.CMD a b c d e f g
: a b c the input
: Ktest7!
:
: This is acceptable to me.
: Does it seem like I'm clear on the concept?
:
Yup. You can also do the same with a loop:
for \%i 0 \fmin(\v(args),9) 1 {
_assign \\%\%i \&@[\%i]
}
Although documented in the manual, this might be a bit obscure. It
illustrates the use of the \v(args) variable (number of command-line words)
and of the _ASSIGN command (note leading underscore), in which the name of
the variable to be assigned is not taken literally (as it is with ASSIGN),
but evaluated and constructed first, so when \%i is 0, this statement
assigns the value of \&@[0] (command-line argument number 0 -- "argv[0] to
C programmers) to the variable \%0, etc. "\fmin(\v(args),9)" ensures that
we don't go above 9, since \%9 is the highest \%<number> variable.
: My goal is to make some command file scripts executable in several OS's
: on my machine in as many ways as possible, with just one file holding the
: script - various flavors of DOS and DOS Emulators, OS/2 and LINUX
: C-Kermit from within the appropriate version of Kermit.
:
If you want to run a Kermit script from system command level, i.e. without
starting Kermit first, it has to follow the syntax rules of the underlying
platform or shell. Thus EXTPROC in OS/2 gives approximately the same
effect as #!/pathname in UNIX, but there is no analogous mechanism in DOS.
Unfortunately, I don't think there is a way to make the first line of the
Kermit script compatible with both.
As Jeff pointed out, you can:
define extproc comment
in any version of Kermit at all. If EXTRPOC is a built-in command (as it
is in the OS/2 version), it will take precedence over the macro definition,
as built-in commands always do; otherwise EXTPROC statements will be
treated as comments. Well, they are even in OS/2, at least by Kermit itself.
Once you get past the first line, it is easy to write portable scripts
by testing the \v(platform), \v(program), \v(system), and other intrinsic
variables, as well as using \$(XXXX) to test or import environment variables.
: Again, much thanks - you guys have unbelievable patience.
:
Thanks for the detailed report. I hope this newsgroup proves as valuable to
Kermit users as it is to us in helping us to refine our documentation,
help-desk procedures, etc, and in deciding how to prioritize our infinitely
long list of things to do.
- Frank